/* eslint valid-jsdoc: "off" */

'use strict';
const path = require('path');
/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_z_990702';
  // todo 这是让上传的所有文件进行配置，否则上传不了文件
  config.multipart={
    mode:'file',
    whitelist:()=>true
  }
  // TODO 这是忽略CSRF检测，否则只能在请求的header中带上token进行检测
  config.security={
    csrf:{
      enable:false,
      ignoreJSON:true
    },
    domainWhiteList:["*"]//todo 不用检测csrf
  }
  // todo 配置静态文件路径
  config.UPLOAD__FILE = path.resolve(__dirname,'..','app/public');

  // add your middleware config here
  config.middleware = [];

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };

  return {
    ...config,
    ...userConfig,
  };
};
